#define DEBUG
#include <cstdio>

using namespace std;

const int maxn = 100000;

int main() {
	freopen("password.in", "r", stdin);
	freopen("password.out", "w", stdout);

	static char s[maxn+2], t[maxn+2];
	static int p[maxn+1], times[maxn+1];
	scanf("%s %s", s+1, t+1);

	int lens=0, lent=1;
	p[1] = 0;
	for (int i=2; t[i]!='\0'; i++) {
		lent++;
		int x=p[i-1];
		for (; x && t[i]!=t[x+1]; x=p[x]);
		if (t[i]==t[x+1]) {
			p[i] = x+1;
		} else {
			p[i] = 0;
		}
	}

	for (int i=1, j=0; s[i]!='\0'; i++) {
		lens++;
		for (; j && t[j+1]!=s[i]; j=p[j]);
		if (t[j+1]==s[i]) {
			j++;
			for (int k=j; k; k=p[k]) {
				if (i>k) {
					times[k]++;
				}
			}
		}
	}

	long long ans=(long long)lens*lent;
	for (int i=1; i<=lent; i++) {
/*
		int j;
		for (j=p[i]; p[j]; j=p[j]);
		if (j) {
			ans -= times[i-j];
		}
		*/
		if (p[i]) {
			ans -= times[i-p[i]];
		}
	}

	printf("%lld", ans);

	fclose(stdin);
	fclose(stdout);
	return 0;
}
